package dbsql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Created by jason on 15/12/8.
 */
public class ConnSQL {
    private static String url = "jdbc:mysql://localhost:3306/LibrarySys";
    private static String username = "root";
    private static String password = "24862";
    private static Connection conn = null;

    public static Connection getConn(){
        try{
            Class.forName("org.mariadb.jdbc.Driver");
            conn = DriverManager.getConnection(url,username,password);
        }catch (Exception e){
            e.printStackTrace();
        }

        return conn;
    }

    public static void CloseConn(){
        try {
            conn.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
